Install @nestjs/typeorm and typeorm, then import TypeOrmModule.forRoot() in AppModule with your database credentials. Set synchronize to false in production and use migrations instead. Use forRootAsync with ConfigService to read credentials from environment variables.
synchronize: true auto-migrates the schema on every app start — safe in development only, destructive in production.
entities glob — finds all entity files; alternatively pass entity classes directly in an array.
Use forRootAsync with ConfigService to read credentials from environment variables safely.
migrationsRun: true applies pending migrations on startup — use with caution in production.
Register TypeOrmModule.forRoot() once in AppModule; feature modules use forFeature() to register their entities.